home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / MISC / CRACKMAN.ZIP / CRACKMAN.TXT
Encoding:
Text File  |  1996-05-24  |  88.5 KB  |  2,267 lines

  1.  
  2.                                                    The Cracking Manual
  3.          ─────────────────────────────────────────────────────────────
  4.                                  Written By The Cyborg - April 3, 1992
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.          Disclaimer
  13.          The author of this text shall hold no liability for special,
  14.          incidental, or consequential damages arising out of or
  15.          resulting from the use/misuse of the information in this
  16.          file.
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                                                    The Cracking Manual
  26.  
  27.  
  28.  
  29.                                   INTRODUCTION
  30.  
  31.          Introduction
  32.          ------------
  33.               Welcome to the wonderful world of cracking.  What is
  34.          cracking?  If you don't know and you're reading this, ask
  35.          yourself why?  Anyway, cracking is the art of removing copy
  36.          protected coding from programs.  Why do this?  In recent
  37.          years, software companies have been fighting to keep copy
  38.          protection in their software to avoid their work to be
  39.          illegally copied.  Users feel that such copy protection is
  40.          ridiculous in that it violate their own rights to make
  41.          backups of their sometimes expensive investments.
  42.               Whichever side you may favor, this manual will go into
  43.          some detail on removing copy protection from programs.  If
  44.          you feel offended by this, then I would suggest you stop
  45.          here.  Please note, I do not endorse cracking for the illegal
  46.          copying of software.  Please take into consideration the hard
  47.          work and effort of many programmers to make the software.
  48.          Illegal copying would only increase prices on software for
  49.          all people.  Use this manual with discretion as I place into
  50.          your trust and judgement with the following knowledge.
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.                                      Page 1
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                                                    The Cracking Manual
  92.  
  93.  
  94.  
  95.                                WHAT YOU WILL NEED
  96.  
  97.          What You Will Need
  98.          ------------------
  99.               Like all programming, cracking is the debugging stage of
  100.          software development.  It is the most tedious and hectic part
  101.          of programming as you shall see.  However, unlike software
  102.          development, you are given no source code, only the machine
  103.          level code commonly called machine language.  Cracking
  104.          demands patience.  No patience, no cracking.
  105.               Before we begin, you will need certain tools.  These
  106.          include:
  107.  
  108.               - A decent computer.  By this, I mean at minimum a 286
  109.                 computer with 2 or more megs of RAM.  A 386 is the
  110.                 ideal since it can load a debugger into usable memory.
  111.               - A source level debugger (eg. Turbo Debugger)
  112.               - A low level debugger (eg. DEBUG)
  113.               - An assembler system (eg. MASM, LINK, EXE2BIN)
  114.               - A hex dumping program (eg. Norton Utilities)
  115.  
  116.          The source level debugger is what you will try to be using
  117.          most of the time.  It provides many features that are a
  118.          convenience to the cracker, such as interrupt redirection.
  119.          Become comfortable with its features.  However, in some
  120.          instances, the source level debugger may not be suitable for
  121.          cracking huge games since the debugger itself may take up too
  122.          much memory.  In such a case, a low level debugger must be
  123.          used since their memory usage may be considered negligible.
  124.          This manual will focus on its use.
  125.               The assembler package will be used in the creation of
  126.          the famed loaders, which provide the cracker with dynamic
  127.          memory alterations without changing the original program.
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.                                      Page 2
  152.  
  153.  
  154.  
  155.  
  156.  
  157.                                                    The Cracking Manual
  158.  
  159.  
  160.  
  161.                        CRASH COURSE IN ASSEMBLY LANGUAGE
  162.  
  163.          Crash Course in Assembly Language
  164.          ---------------------------------
  165.               If you are already well familiar with the assembly
  166.          language, you may wish to skip this section.  Cracking
  167.          demands the knowledge of assembly language.  If you wish to
  168.          become a "serious" cracker, you might like to read up more
  169.          about this fascinating language.  This section will only give
  170.          you enough info for intermediate level cracking.
  171.               At this point, you should familiarize yourself with
  172.          DEBUG and its commands as we will be using them shortly.
  173.  
  174.          Registers
  175.          ---------
  176.               One of the neato things that you will be fooling around
  177.          most often with are called the registers.  Registers are like
  178.          variables (such as in BASIC) that are located within the CPU
  179.          itself.  These registers may hold a positive integer from 0
  180.          to 255 or from 0 to 65535.  They can also hold negative
  181.          integers from -128 to 127 or from -32768 to 32767.  The
  182.          registers are given names as follows:
  183.  
  184.               AX => accumulator - this register is most commonly used
  185.                     for mathematical or I/O operations
  186.               BX => base - this register is used commonly as a base or
  187.                     a pointer register (we'll talk more about this
  188.                     later)
  189.               CX => count - used commonly for counting instructions
  190.                     such as loops
  191.               DX => displacement - much like the base register
  192.  
  193.          The registers stated above are considered general purpose
  194.          registers, since they can basically be used to store whatever
  195.          the user wants.  Let's try putting some number in these
  196.          registers.  Type in "R {enter}".  You should see a bunch of
  197.          info, of which are four of the above mentioned registers.
  198.          Now, type in "RAX {enter}".  Then type in a number like
  199.          8FABh.  Type in "R" again and noticed how the accumulator
  200.          (AX) has change its number.
  201.               These general purpose registers can also be "split" in
  202.          half into its higher and lower order components.  Instead of
  203.          having one register AX, you can have two registers, AH and
  204.          AL.  Note however that while you have a range of 0 to FFFFh
  205.          for AX, you will now have a range of 0 to FF for AH and AL.
  206.          You cannot change these directly in debug, but be aware that
  207.          programs will use it.  If AX contains 0A4Ch, then AH will
  208.          contain 0Ah and AL will contain 4Ch.
  209.               The following are called the segment registers:
  210.  
  211.               CS => code segment - the block of memory where the code
  212.                     (instructions are located)
  213.               DS => data segment - the block of memory where data can
  214.                     be accessed.  In block move operations in which
  215.  
  216.  
  217.                                      Page 3
  218.  
  219.  
  220.  
  221.  
  222.  
  223.                                                    The Cracking Manual
  224.  
  225.  
  226.  
  227.                     huge blocks of memory are moved, this is commonly
  228.                     the segment in which the CPU reads from.
  229.               ES => extra segment - also another data segment.  In
  230.                     block move operations in which huge blocks of
  231.                     memory are moved, this is commonly the segment in
  232.                     which the CPU writes to.
  233.               SS => stack segment - this is the block of memory in
  234.                     which the CPU uses to store return addresses from
  235.                     subroutines.  (more on this later)
  236.  
  237.          In introductory level of cracking, we don't mess around with
  238.          these registers.  Later, we will see how we can use these to
  239.          trick a program into thinking other things, but that's later.
  240.          You can also change these registers in debug.  Type in "RCS
  241.          {enter}".  Then enter "0 {enter}" and notice how the CS
  242.          register changed.
  243.               There are other registers that we use to see what the
  244.          program is doing.  These registers can also be change in
  245.          debug.  Included are the following:
  246.  
  247.               SI => source index - this register is used in
  248.                     conjunction with block move instructions.  This is
  249.                     a pointer within a segment (usually DS) that is
  250.                     read from by the CPU.
  251.               DI => destination index - this register is also used in
  252.                     conjunction with block move instructions.  This is
  253.                     a pointer within a segment (usually ES) that is
  254.                     written to by the CPU.
  255.               BP => base pointer - a pointer used commonly with the
  256.                     stack segment
  257.               SP => stack pointer - another pointer used commonly with
  258.                     the stack segment (this one, you don't touch)
  259.  
  260.               By now, you may probably be confused about this
  261.          segment/pointer bit.  Here is an analogy that my straighten
  262.          things out.
  263.               Pretend you are in kindergarden learning to read.  There
  264.          are four black boards surrounding the room.  These black
  265.          boards are like SEGMENTS.  Let's pretend the front blackboard
  266.          is the code segment (CS).  The teacher has written some
  267.          instructions on pronunciation rules.  This is what the
  268.          students refer to when they try to pronounce words.  In a
  269.          program, this is what the CPU refers to when it follows
  270.          directions.
  271.               Okay, now the teacher has gone to the blackboard on the
  272.          left of the classroom.  We will call this board the data
  273.          segment (DS).  The teacher has also written a set of words on
  274.          the board.  Then she uses a wooden stick or a POINTER to
  275.          point to a word.  Let's pretend this stick is the source
  276.          index (SI).  She points to the word "their".  Now, the
  277.          students look at the front blackboard (CS) to see how to
  278.          pronounce the word and they say "their".
  279.               Now, the instructor wants the students to learn how to
  280.          write.  She points the stick to the word "apple".  The
  281.  
  282.  
  283.                                      Page 4
  284.  
  285.  
  286.  
  287.  
  288.  
  289.                                                    The Cracking Manual
  290.  
  291.  
  292.  
  293.          students pronounce the word.  Then she goes to the blackboard
  294.          on the right.  We shall call this one the extra segment (ES).
  295.          She then uses her finger as a different POINTER and points to
  296.          a location on the board where Mary Jane will write "apple".
  297.               That's basically what segments and pointers are.
  298.          Segments are the blackboards and pointers are the teacher's
  299.          stick (we're not talking sexually here) or finger.
  300.               One last important register is the flags register.
  301.          These registers control how certain instruction work, such as
  302.          the conditional jumps (in BASIC, they are like IF-THEN's).
  303.          They are stored as bits (0's or 1's) in the flags register.
  304.          We will most often use:
  305.  
  306.               zero => ZR/NZ (zero/not zero) - tells you whether an
  307.                       instruction (such as subtraction) yielded a zero
  308.                       as an answer
  309.               sign => NG/PL (negative/positive) - tells you whether an
  310.                       instruction yielded a positive or negative
  311.                       number
  312.               carry => CY/NC (carry/no carry) - tells you whether an
  313.                       instruction needed to carry a bit (like in
  314.                       addition, you carry a number over to the next
  315.                       digit).  Various system (BIOS) functions use
  316.                       this flag to denote an error.
  317.               direction => DN/UP (decrement/increment) - tells a block
  318.                       instruction to either move forward or backwards
  319.                       in reads and writes
  320.  
  321.          Try changing some of these bits.  Type in "RF {enter}".  Then
  322.          type in "DN {enter}" to change the direction flag to its
  323.          decrement position.
  324.  
  325.          The Instructions
  326.          ----------------
  327.  
  328.          MOV - move
  329.          ----------
  330.               Now we get to the actual instructions or commands that
  331.          the CPU will use.  The first instruction you will see most
  332.          often is the move instruction.  Its form is
  333.          MOV {destination},{source}.  Let's try programming now.  Exit
  334.          (q) and reenter debug again.  Now, type in "A {enter}".  You
  335.          will see a bunch of number to the left.  You can think of
  336.          these as line numbers.  Now type in "MOV AX,7A7A {enter}".
  337.          Then type "MOV DX,AX" and so on until your program looks
  338.          similar to the one below:  (type "U 100" to see)
  339.  
  340.          xxxx:0100 B8A77A         MOV    AX,7AA7
  341.          xxxx:0103 89C2           MOV    DX,AX
  342.          xxxx:0105 B90000         MOV    CX,0000
  343.          xxxx:0108 88D1           MOV    CL,DL
  344.          xxxx:010A 890E0005       MOV    [0500],CX
  345.          xxxx:010E 8B160005       MOV    DX,[0500]
  346.          xxxx:0112 BB0200         MOV    BX,0002
  347.  
  348.  
  349.                                      Page 5
  350.  
  351.  
  352.  
  353.  
  354.  
  355.                                                    The Cracking Manual
  356.  
  357.  
  358.  
  359.          xxxx:0115 26A30005       MOV    ES:[0500],AX
  360.  
  361.          Press enter again until you see the "-" prompt again.  You
  362.          are ready to run your first program.  Type "R {enter}" and
  363.          note the values of the general purpose registers.  Then type
  364.          in "T {enter}".  Debug will automatically display the
  365.          registers after the execution of the instruction.  What is in
  366.          the AX register?  It should be 7AA7h.  Now, "T" again.  What
  367.          is in the DX register?  It should also be 7AA7h.  Trace again
  368.          using "T" and note that CX should be 0 if it was not already.
  369.          Trace again and note what is in the CX register.  It should
  370.          be 00A7h.  Now trace another step.  What is this instruction
  371.          doing?  It is now moving the contents of CX into memory
  372.          location 500h in the data segment (DS).  Dump the memory by
  373.          typing in "D 500".  The first two two-digit numbers should be
  374.          the same as in the CX register.  But wait a minute you say.
  375.          They are not the same.  They are backwards.  Instead of
  376.          00A7h, it is A700h.  This is important.  The CPU stores 16
  377.          bit numbers in memory backwards to allow for faster access.
  378.          For 8 bit numbers, it is the same.  Now, continue tracing.
  379.          This instruction is moving the memory contents of address
  380.          500h into the DX register.  DX should be 00A7h, the same as
  381.          CX regardless of how it looked in memory.  The next trace
  382.          should be nothing new.  The next trace again moves the
  383.          contents of a register into memory.  But notice it is using
  384.          the BX register as a displacement.  That means it adds the
  385.          contents of BX and 500h to get the address, which turns out
  386.          to be 502h.  But also not the "ES:" in front of the address.
  387.          This additional statement tells the CPU to use the extra
  388.          segment (ES) rather than the data segment (DS which is the
  389.          default).  Now dump address 502h by entering "D ES:502" and
  390.          you should see A77Ah, which is backwards from 7AA7h.
  391.  
  392.          CMP/J? - compare/conditional jump
  393.          ---------------------------------
  394.               Another instruction you will see quite often is the CMP
  395.          or compare instruction.  This instruction compares the two
  396.          "variables" and changes the flags register accordingly.  The
  397.          source and destination operands are the same as those for the
  398.          move instruction.
  399.               Let's consider an example in which the AX register holds
  400.          21 and the BX register holds 22.  Then "CMP AX,BX" is
  401.          performed.  The compare instruction is like a subtraction
  402.          instruction, but it doesn't change the contents of the AX
  403.          register.  So, when 22 is subtracted from 21, the answer will
  404.          be -1, but we will never see the answer, only the flags which
  405.          have resulted from the operation.  Number 21 is less than 22,
  406.          so the carry flag and the sign flag should be set.  Just
  407.          remember that when the carry flag is set, the first number is
  408.          less than the second number.  The same is true for the sign
  409.          flag.  Why have two flags if they tell us the same thing?
  410.          This is more complicated and you should not concern yourself
  411.          with it.  It requires knowledge of hexadecimal arithmetic,
  412.          the denotation of signed and unsigned integers.
  413.  
  414.  
  415.                                      Page 6
  416.  
  417.  
  418.  
  419.  
  420.  
  421.                                                    The Cracking Manual
  422.  
  423.  
  424.  
  425.               So, now that we have done the compare instruction, there
  426.          will most likely be a conditional jump instruction after.  If
  427.          we wanted to jump if AX is less than BX (which it is), then
  428.          there would be an instruction like "JB 200".  This
  429.          instruction says Jump if Below to instruction 200h.  What
  430.          about if we wanted to jump if AX is greater than BX.  Then we
  431.          might have "JA 200".  This is read Jump if Above to
  432.          instruction 200.  What about AX equal to BX.  We would then
  433.          have "JZ 200" or "JE 200".  (Please note that the previous
  434.          instructions are synonymous.)  This is read Jump if Equal to
  435.          instruction 200h.  Here are the jumps you will most likely
  436.          encounter:
  437.  
  438.               Mnemonic  Flag(s) Checked  Description
  439.          -------------------------------------------------------------
  440.               JB/JNAE   CF=1             Jump if below/not above or
  441.                                          equal (unsigned)
  442.               JAE/JNB   CF=0             Jump if above or equal/not
  443.                                          above (unsigned)
  444.               JBE/JNA   CF=1 or ZF=1     Jump if below or equal/not
  445.                                          above (unsigned)
  446.               JE/JZ     ZF=1             Jump if equal/zero
  447.               JNE/JNZ   ZF=0             Jump if not equal/not zero
  448.               JL/JNGE   SF not equal     Jump if less/not greater or
  449.                         to OF            equal (signed)
  450.               JGE/JNL   SF=OF            Jump if greater or equal/not
  451.                                          less (signed)
  452.               JLE/JNG   ZF=1 or SF       Jump is less or equal/not
  453.                         not equal OF     greater (signed)
  454.               JG/JNLE   ZF=0 or SF=OF    Jump if greater/not less or
  455.                                          equal (signed)
  456.               JS        SF=1             Jump if sign
  457.               JNS       SF=0             Jump if no sign
  458.               JC        CF=1             Jump if carry
  459.               JNC       CF=0             Jump if no carry
  460.               JO        OF=1             Jump if overflow
  461.               JNO       OF=0             Jump if not overflow
  462.               JP/JPE    PF=1             Jump if parity/parity even
  463.               JNP/JPO   PF=0             Jump if no parity/parity odd
  464.  
  465.          There are all the possible combinations of conditional jumps
  466.          that you will encounter.  I realize that we have not
  467.          discussed some of the flags such as overflow or parity, but
  468.          be aware that they exist and programs sometimes use them.
  469.  
  470.          JMP - jump
  471.          ----------
  472.               This instruction does what it suggests.  It jumps too
  473.          different sections of code.  Several forms of the jump
  474.          instruction include:
  475.  
  476.          2E0B:0208 EBF6           JMP    0200
  477.          2E0B:020A 3EFF24         JMP    DWORD PTR DS:[SI]
  478.  
  479.  
  480.  
  481.                                      Page 7
  482.  
  483.  
  484.  
  485.  
  486.  
  487.                                                    The Cracking Manual
  488.  
  489.  
  490.  
  491.          The first instruction jumps to an address within the segment.
  492.          The latter instruction jumps to an address pointed to by ds:
  493.          si.  The DWORD says that this will be a far jump, a jump to a
  494.          different segment (a different blackboard).  So, if the
  495.          double word that is pointed to by ds:si contains 1000:0040h,
  496.          then, the instruction will jump to 1000:0040h whereas the
  497.          previous jump instruction will jump within the current
  498.          segment (or blackboard).
  499.  
  500.          CALL - procedural transfer
  501.          --------------------------
  502.               This instruction is the baby that you will be carefully
  503.          watching out for most often.  This instruction calls another
  504.          procedure and upon it's completion, will return to calling
  505.          address.  For example, consider the following block of code:
  506.  
  507.          2E0B:1002 E8BB46         CALL   56C0
  508.          2E0B:1005 7209           JB     1010
  509.          2E0B:1007 0C00           OR     AL,00
  510.  
  511.          The first line calls another procedure at "line number"
  512.          56C0h.  Upon its completion, the instruction pointer will
  513.          point to the second line.  Note that there is a "JC"
  514.          instruction.  Remember that programs often use the carry flag
  515.          to signal errors.  If the call instruction called a copy
  516.          protection instruction and you entered a wrong code or
  517.          something, it may return with the carry flag set.  The next
  518.          instruction would then jump if there was an error to an
  519.          exiting procedure.
  520.               Note, this is a near call.  A program can also have far
  521.          calls just like jumps.
  522.  
  523.          INT - generate an interrupt
  524.          ---------------------------
  525.               This instruction is much like the call instruction.  It
  526.          also transfers control to another procedure.  However, the
  527.          number after the INT instruction does not point to an
  528.          address.  Instead, it is a number pointing to an address that
  529.          is located in something called an interrupt vector.  You will
  530.          commonly see "INT 10", "INT 21", "INT 13".  Just know (for
  531.          now) that they are like calls to procedures.
  532.  
  533.          LODSB/LODSW/STOSB/STOSW - load/store a byte/word
  534.          ------------------------------------------------
  535.               These instructions either load in or store a byte or a
  536.          word to or from memory.  The DS:SI register pair points to
  537.          the source data.  These are the registers the CPU will use
  538.          when reading from memory using the LODS instruction.  The
  539.          AX/AL register will hold the number to either read from or
  540.          write to the memory.  So, if DS:SI points to a byte which is
  541.          maybe 60, then a "LODSB" instruction will load in the number
  542.          60 into the AL register.  A LODSB or STOSB will use the AL
  543.          register while the LODSW or STOSW will use the AX register.
  544.               The STOS writes whatever is in the AX/AL register to the
  545.  
  546.  
  547.                                      Page 8
  548.  
  549.  
  550.  
  551.  
  552.  
  553.                                                    The Cracking Manual
  554.  
  555.  
  556.  
  557.          memory pointed to by ES:DI.  So, if ES:DI points to 100:102h
  558.          and if AL held 50, then the byte at 100:102h will hold 50.
  559.               After the instruction is finished, the CPU will either
  560.          increment or decrement SI or DI according to the status of
  561.          the direction flag.  So, if SI was 100h and a "LODSW"
  562.          instruction was performed with a cleared direction flag
  563.          (forward), the SI will now point to 102h.
  564.  
  565.          MOVSB/MOVSW - copies a byte/word from source to destination
  566.          -----------------------------------------------------------
  567.               This instruction gets a byte or a word from the data
  568.          pointed to by DS:SI and copies it to the data pointed to by
  569.          the ES:DI address.  When the instruction is finished, SI and
  570.          DI will be incremented or decremented accordingly with the
  571.          status of the direction flag.  So, if DS:SI pointed to a byte
  572.          with the number 30, a "MOVSB" instruction would copy into the
  573.          byte pointed to by ES:DI the number 30.
  574.  
  575.          REP - repeat
  576.          ------------
  577.               The REP instruction in front of a MOVS/LODS/STOS would
  578.          cause the MOVS/LODS/STOS instruction to be repeated for a
  579.          number of times specified in the CX register.  So, if CX
  580.          contained 5, then "REP STOSB" would store whatever was in the
  581.          AL register into the byte pointed to by ES:DI five times,
  582.          increasing DI each time.
  583.  
  584.          LOOP - looping
  585.          --------------
  586.               The LOOP instruction repeats a block of instructions for
  587.          a certain number of times.  This number will be held in the
  588.          CX register.  Each time we reach this instruction, the CPU
  589.          will decrement the CX register and jump to a specified
  590.          instruction until CX becomes zero.  This instruction looks
  591.          like "LOOP 1A00" where the number indicates the instruction
  592.          address to loop to.
  593.  
  594.          Arithmetic Operators
  595.          --------------------
  596.               Arithmetic instructions allow you to perform various
  597.          arithmetic function of data.  "ADD" and "SUB" work the same
  598.          way as "MOV" instructions do in that it subtracts whatever is
  599.          in the source register from the destination register and
  600.          stores it in the destination register.
  601.               The "MUL" and "DIV" instructions are a bit more
  602.          complicated and they are not used as intensively as the "ADD"
  603.          or "SUB" since they are slow, so we will not talk about them.
  604.               There are also a multitude of other instructions that
  605.          you should familiarize yourself with if you are thinking of
  606.          becoming a serious cracker.  The instructions given above are
  607.          only the BARE minimum that you need.  There is no way around
  608.          learning assembly for better cracking.
  609.  
  610.  
  611.  
  612.  
  613.                                      Page 9
  614.  
  615.  
  616.  
  617.  
  618.  
  619.                                                    The Cracking Manual
  620.  
  621.  
  622.  
  623.                                   THE CRACKING
  624.  
  625.          The Cracking
  626.          ------------
  627.               Now the fun stuff begins.  First, we must discuss the
  628.          different forms of copy protection schemes.  They are
  629.          basically divided into the disk based and manual based copy
  630.          protection schemes.
  631.               With disk based schemes, the software often reads from
  632.          specific sectors on a disk to determine the disk's validity.
  633.          How can this be done?  When you perform a disk format, the
  634.          disk is formatted with specific sector sizes.  Once the
  635.          sector size changes, DOS cannot recognize it, thinking that
  636.          it is a bad sector.  Since this looks like a bad sector, a
  637.          simple DISKCOPY will not work in copying such disks.
  638.          Interrupt 13h (the assembly mnemonic is INT 13) was commonly
  639.          used to handle such copy protections.  It is now very rare to
  640.          encounter the once famed INT 13h copy protection method
  641.          nowadays since it was quite easy to defeat.  Any professional
  642.          commercial software will often use their own custom based
  643.          disk I/O routines.  This involves intimate access to I/O
  644.          ports using IN and OUT instructions.  This is beyond the
  645.          scope of the first release of this manual.  However, if you
  646.          are lucky, the I/O functions might be called from a "CALL"
  647.          instruction in which case you may defeat the protection
  648.          without much difficulty.  Another disk based scheme used to
  649.          denote legality of software is used during the installation
  650.          process of the software.  With certain programs, when you
  651.          install it, it copies the files into the hard drive.  But it
  652.          also sets a specific sector in the hard drive so that the
  653.          program can recognize it.  This is also similar to diskette
  654.          copy protections, but can be defeated in much the same way.
  655.               Thank goodness that disk based copy protections are
  656.          almost completely out of the software industry.  However, a
  657.          sometimes more difficult copy protection scheme has arisen
  658.          that may sometimes prove to be even more difficult to crack.
  659.          These schemes are commonly known as the doc checks in which
  660.          the user must have a copy of the manual to bypass the
  661.          protection.  With programs compiled as true assembly (you can
  662.          call then "normal" programs), these protections are not too
  663.          bad to trace through and crack.  With programs that run
  664.          scripts (such as Sierra games), this can he a real chore
  665.          however.  Why?  It is because it is like running a program
  666.          within a program.  You just have to be very very patient in
  667.          this case, carefully tracing through the instructions.
  668.               As if these copy protection schemes weren't enough,
  669.          software companies have also added trace inhibition schemes
  670.          to their code.  What does this mean?  This means that you
  671.          will have a hell of a time trying to trace through code.
  672.          However, if you know how these things work, it should not be
  673.          too much of a problem.
  674.               Run-time compression/decompression and
  675.          encryption/decryption of files also make changes to the
  676.          program difficult.  In this case, the loader sure comes in
  677.  
  678.  
  679.                                     Page 10
  680.  
  681.  
  682.  
  683.  
  684.  
  685.                                                    The Cracking Manual
  686.  
  687.  
  688.  
  689.          handy.  Also, when the data within the file changes due to
  690.          overlays, loaders are also good to use.
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.                                     Page 11
  746.  
  747.  
  748.  
  749.  
  750.  
  751.                                                    The Cracking Manual
  752.  
  753.  
  754.  
  755.                           DISK BASED COPY PROTECTIONS
  756.  
  757.          Disk Based Copy Protection
  758.          --------------------------
  759.               Since disk based copy protection schemes are rarely
  760.          used, we will not go into great depth in its discussion.
  761.  
  762.          INT 13h
  763.          -------
  764.               I have previously mentioned that INT 13h copy protection
  765.          schemes are hardly ever used anymore.  Nevertheless, it would
  766.          be good practice for the beginner to learn how to defeat the
  767.          code.  You will most likely see INT 13h used with function 2,
  768.          read sector.  This means that:
  769.  
  770.               AH => will contain the number 2 (function 2)
  771.               AL => the number of sectors to read in.  This is
  772.                     commonly only 1 since you just want to check a few
  773.                     sectors for disk validity.
  774.               CH => will contain the cylinder number
  775.               CL => will contain the sector number
  776.               DH => will contain the head number
  777.               DL => will contain the drive number
  778.                     00h - 7Fh for floppies
  779.                     80h - FFh for fixed disks
  780.               ES:BX => will point to the address into which the data
  781.                     read from the disk will be written to
  782.  
  783.               Upon the return for this interrupt, if the carry flag is
  784.          set, that means that the program could not read the sector,
  785.          and therefore the disk is valid.  If the carry flag is clear,
  786.          that meant that INT 13h could read the sector properly and so
  787.          the disk would be bad in the eyes of the program, thinking it
  788.          was a copied disk.
  789.               Okay, now that we know to look for INT 13h in the
  790.          program code, we can begin tracing.  First, we must know the
  791.          difference between debug's "T" and "P".  "T" is the trace
  792.          instruction, which tells it to follow instructions step by
  793.          step.  That also means that in LOOP or REP instruction, the
  794.          trace will patiently go through the loop until finished.
  795.          Also, during CALL instructions, trace will go into the call
  796.          and execute the instructions pointed to by the call
  797.          instruction.  The "P" command is similar to the "T" but with
  798.          the difference in that it traces over instructions.  That
  799.          means that if it encounter a LOOP or REP, it will quickly
  800.          finish up the loop and point to the next instruction.  With a
  801.          CALL, the "P" (proceed) will not go into the subroutine.
  802.          Instead, it will just execute the procedure, then point to
  803.          the next instruction.
  804.               Okay, before you start tracing for hours through a
  805.          program, you must first notice when and where the copy
  806.          protection appears.  Run the program in DOS first and make
  807.          careful note of when things happen.  You might see an intro
  808.          screen, then the music pops up, then the menu comes out.
  809.  
  810.  
  811.                                     Page 12
  812.  
  813.  
  814.  
  815.  
  816.  
  817.                                                    The Cracking Manual
  818.  
  819.  
  820.  
  821.          Notice this so you will know where you are in the program.
  822.               Once you have done that, you can begin debugging the
  823.          program.  Whenever you start out with a program, you use "P"
  824.          to trace through the program.  Be patient as this might take
  825.          a while.  While you are tracing, watch out for CALLs and
  826.          INTerrupts.  When you are just about to execute the step, try
  827.          to remember the segment and offset of the instruction.  The
  828.          segment is the number to the left of the colon while the
  829.          offset is the number to the right.  As you continue tracing
  830.          through the program, you will find that the screen might
  831.          blank and display the intro screen or something like that.
  832.          This is a good sign and it tells you that you are headed in
  833.          the right direction.  Start slowing down when you feel that
  834.          you are near to the copy protection.
  835.  
  836.          Situation 1 - Exit from copy protected CALL
  837.          -------------------------------------------
  838.               Oops, you have traced over a call that accessed drive A.
  839.          Unfortunately, you also exited the program.  That's good.
  840.          You have just narrowed down the location of the copy
  841.          protection code.  Now I hope you remembered the address of
  842.          that CALL.  If not, you gotta start all over to find it.
  843.          Anyway, restart the program now.  Now Go to that instruction
  844.          by "G {segment:address}".
  845.               Did something go wrong?  Did the computer freeze or
  846.          something?  It is most likely that this is an overlay or
  847.          encrypted code or something that caused the code at that
  848.          location to change.  In this case, you will have to remember
  849.          the addresses of various instructions along the way.
  850.          Instructions that you want to take note of are far calls (if
  851.          you remember, calls with a segment:offset address as their
  852.          operand).  You don't have to do this for every call.  As you
  853.          crack more and more, you will get the hang of which
  854.          instructions to keep track of.
  855.               Okay, let's assume you have gotten back into the
  856.          location of the code again.  It is a CALL instruction that
  857.          will access the disk drive.  At this point, try skipping the
  858.          CALL instruction.  To do this, type in "RIP {enter}".  Then
  859.          type in the address of the next instruction.  Then execute
  860.          the do or die instruction, "G".  If the program runs fine
  861.          without asking for the copy protection, congratulations!  You
  862.          have cracked the program.
  863.               If the program freezes or does something weird, restart
  864.          the program and trace back to the suspected copy protected
  865.          location.  Now use the "T" command once and start using "P"
  866.          again.  Remember to write down the address of that CALL
  867.          instruction you just traced into so you can come back to it
  868.          quickly.  As you keep tracing, using the above procedures,
  869.          pretend you eventually come up to an INT 13h instruction.
  870.          See what it does by tracing over it.  Make sure you have a
  871.          disk in drive A too.  If there was no error, force an error
  872.          by turning on the carry flag and proceeding.  With INT 13h
  873.          copy protections, this should be sufficient to crack the
  874.          program.
  875.  
  876.  
  877.                                     Page 13
  878.  
  879.  
  880.  
  881.  
  882.  
  883.                                                    The Cracking Manual
  884.  
  885.  
  886.  
  887.          Situation 2 - Return from copy protected CALL
  888.          ---------------------------------------------
  889.               Okay, the CALL that you just traced over accessed the
  890.          disk drive, but it didn't kick you out.  Keep on proceeding
  891.          and this point.  If there is an instruction that causes you
  892.          to jump because of a carry flag, try fooling around with this
  893.          carry flag and see how the program reacts.  INT 13h copy
  894.          protections are usually simple enough for you to just change
  895.          the carry flag to allow the program to bypass the copy
  896.          protection.
  897.  
  898.          Access to the Hard Drive
  899.          ------------------------
  900.               The cracking for installation software is also the same
  901.          as cracking for the INT 13h.  You just keep tracing until you
  902.          see some disk activity.  At that point, you try messing
  903.          around with some of the conditional jumps to see what
  904.          happens.  If you have the original program, you should run it
  905.          also to see the differences between the valid and invalid
  906.          copies.
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.                                     Page 14
  944.  
  945.  
  946.  
  947.  
  948.  
  949.                                                    The Cracking Manual
  950.  
  951.  
  952.  
  953.                            DOC CHECK COPY PROTECTIONS
  954.  
  955.          Doc Check Copy Protections
  956.          --------------------------
  957.               Okay, we have just quickly scanned over disk based copy
  958.          protections because they are rarely used nowadays.  Doc
  959.          checks will be discussed in greater detail for the rest of
  960.          this manual.
  961.               Unlike the disk based protections, which are based on
  962.          hardware identification, doc checks are based on software
  963.          identification.  Therefore, the only information that will
  964.          indicate that a copy protection is happening is the screen,
  965.          unlike the whirr of the disk drive.  The moral, watch the
  966.          screen.  Because this copy protection is software based, it
  967.          will be more of a challenge to trace, but of course, that is
  968.          the "fun" part of cracking.
  969.  
  970.          The Basics
  971.          ----------
  972.               Make sure you have the COMPLETE version of the program
  973.          you are about to crack.  When you do, run the program in DOS.
  974.          While the program is loading, take note of exactly what goes
  975.          on with the screens, sounds, etc.  Here is what you might
  976.          want to note:
  977.  
  978.               1)  What comes up first?  Is it a standard text output
  979.                   that asks you for the type of graphics adaptor you
  980.                   have, the number of joysticks, the sound card?
  981.               2)  When does the intro screen come up?  Is it after the
  982.                   music starts?  After the copyright notice?  After
  983.                   the text prompt for the graphics mode you will be
  984.                   operating in?
  985.               3)  What happens now?  An animated sequence that brings
  986.                   you through the beginning plot of a game?  If so,
  987.                   can you press a key and escape from it?
  988.               4)  Now what?  Is there a main menu?  When you start the
  989.                   game by selecting the "START GAME" option from the
  990.                   menu, does the copy protection come up immediately?
  991.               5)  If it doesn't come up immediately, when does it come
  992.                   up?
  993.               6)  Does the copy protection only appear when you are
  994.                   playing the game, or does it come up also when you
  995.                   select "CHANGE OPTIONS" from the main menu?
  996.  
  997.          Obviously, these questions are merely prompts for you to
  998.          follow.  Use your own mind in discovering what to take note
  999.          of.  There are no set rules for cracking.  It is a puzzle
  1000.          that you must use your mind on.
  1001.               Okay, once you have run the program, go into your
  1002.          debugger (in our case, DEBUG) and load up the program.  One
  1003.          tip to use when you first start out programming is to use the
  1004.          "P" command to trace through code.  As you become a more
  1005.          advanced cracker, you might start seeing patterns in coding.
  1006.          These patterns are characteristic of high level programming
  1007.  
  1008.  
  1009.                                     Page 15
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.                                                    The Cracking Manual
  1016.  
  1017.  
  1018.  
  1019.          languages (Pascal, C, etc.) and are usually the
  1020.          initialization code for the rest of the program.  Use "P" for
  1021.          each instruction, one at a time.  Be patient as this might
  1022.          take a while.
  1023.               Okay, you have been tracing for some time now and
  1024.          finally, you notice something happen.  The screen might have
  1025.          blanked or maybe a message prompting you to enter the
  1026.          graphics mode may have popped up.  Was this what you have
  1027.          noted before?  It should be and you can assure yourself that
  1028.          you are headed in the right direction.  As you keep tracing
  1029.          programs, you notice that CALLs usually do something
  1030.          significant.  A CALL might clear the screen or sound some
  1031.          music.  When it does something rad like this, write down its
  1032.          address as the segment:offset pair.  The segment is the
  1033.          number to the left of the colon while the offset is the
  1034.          number to the right of the colon.  Don't be a dork and set a
  1035.          breakpoint there.  Write it down on paper or something.  We
  1036.          will see later on why breakpoints fail miserably in the cool
  1037.          wares.
  1038.               Why take note of these instructions?  As you trace
  1039.          deeper and deeper into programs, the coding often loads up
  1040.          overlays or maybe decompresses code to the memory location
  1041.          that you have just traced over.  Therefore, if you set a
  1042.          breakpoint there, or execute a "G" instruction to that
  1043.          address, you will fuck up the program and cause your computer
  1044.          to freeze.  We will see why when we examine how breakpoints
  1045.          and single stepping works.
  1046.               Also, while you are tracing using "P", mentally remember
  1047.          the addresses of the CALLs.  That way, if you trace over a
  1048.          call that brought you immediately to the copy protection, you
  1049.          won't have to retrace the code again.  You don't have to
  1050.          write down all of the addresses, of course, just remember one
  1051.          at a time and write them down if they do anything
  1052.          significant.
  1053.  
  1054.          Code Guards Through Keyword Entry
  1055.          ---------------------------------
  1056.               Okay, you know that the copy protection is one in which
  1057.          the program waits for you to type in a keyword that you have
  1058.          to look up in the manual or something.  Here are then
  1059.          following steps you should take.
  1060.  
  1061.          Situation 1 - Return from a copy protected CALL
  1062.          -----------------------------------------------
  1063.               When a copy protection coding reveals itself on the
  1064.          screen, you can have a situation in which you are returned to
  1065.          the debugger, waiting for the next instruction to be
  1066.          executed.  Now, suppose that the CALL asked you to enter a
  1067.          code.  You entered an incorrect code and were returned to the
  1068.          debugger, but you have not exited the program.  Make sure
  1069.          that you have previously recorded the address of this CALL.
  1070.          Now, you can do two things, (1) you can try skipping over the
  1071.          CALL, (2) you can trace on further.  As you become more
  1072.          experienced, you will be able to better decide.  As one with
  1073.  
  1074.  
  1075.                                     Page 16
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.                                                    The Cracking Manual
  1082.  
  1083.  
  1084.  
  1085.          experience, however, I can say that 90% of the time, you will
  1086.          have to trace further on, but hey, you might get lucky.
  1087.               For now, let's say you are lazy and decide that you want
  1088.          to skip over the call to see what happens.  To do this, you
  1089.          must restart the program.  Then trace your way back to the
  1090.          CALL where the copy protection was located.  Use "G
  1091.          {segment:offset}" to do this.  If, for some reason, the
  1092.          computer freezes when you do this, you will have to use "G"
  1093.          followed by the addresses of the CALLs that you have noted
  1094.          down to be significant.  If that doesn't work, resort to
  1095.          retracing the code over again.  As you become more
  1096.          experienced, you will find that you rarely have to retrace
  1097.          the entire code since you can "feel" what is going on.  Okay,
  1098.          now that you are at the location of the CALL, this is the
  1099.          time to skip over the instruction.  To do this, enter "RIP"
  1100.          and then the address of the next instruction's address.  Now
  1101.          enter the "G" command and see what happens.  If the program
  1102.          runs just fine, you've cracked the program.  If the program
  1103.          kicks you out or crashes, you have to do some more tracing.
  1104.               Okay, so you've decided to continue tracing from the
  1105.          point of the copy protection.  There are usually a bunch of
  1106.          CMP and J? CMPS? instructions after the call.  This point on
  1107.          is the difficulty of cracking for a beginner since you don't
  1108.          know what the fuck is going on.  All those compares and jumps
  1109.          don't mean shit to you are you are about to pass out in
  1110.          frustration.  Don't distress, here are a few tips I can give
  1111.          you.  If these don't work, you gotta find out your own
  1112.          solutions to the problem.
  1113.               Okay, in all probability, the CALL that you just traced
  1114.          over was acting as a read string procedure (like BASIC's
  1115.          INPUT).  That means somewhere in the computer's memory, there
  1116.          lies the code that you typed in and the code that you were
  1117.          supposed to have typed in.  What this would mean is that the
  1118.          code after the CALL will do some sort of string comparison.
  1119.          Look out for these.  It might be hidden inside another CALL
  1120.          if you're lucky.  In such a case, does the program kick you
  1121.          out?  If it does, you have to trace into the call using "T"
  1122.          to see what is going on.  Okay, the string comparison will
  1123.          most likely take the form of some kind of loop.  Maybe "REP
  1124.          CMPSB" or "LOOP".  In the case of the REP CMPSB, there might
  1125.          be a JZ/JNZ or JCXZ/JECXZ that follows it.  When strings
  1126.          match, the CX register will be zero.  If CX is not zero, the
  1127.          strings are not the same and the conditional jump will
  1128.          probably jump to an exit routine.  All you have to do is to
  1129.          change the status of the zero flag.  Then, try out the "G"
  1130.          instruction.  If it still didn't work, start over and do some
  1131.          more tracing.  If the string compare is not of the REP form,
  1132.          there will be some kind of loop that will check between two
  1133.          memory locations.  In such a case, you will just have to
  1134.          become accustomed to realizing that the code is a string
  1135.          compare.  There is no standard code for this.  If you know
  1136.          you have entered a wrong code, trace through the loop and see
  1137.          where in the loop you are thrown out of the loop.  At this
  1138.          point, you can go back to it, change some flags to make sure
  1139.  
  1140.  
  1141.                                     Page 17
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.                                                    The Cracking Manual
  1148.  
  1149.  
  1150.  
  1151.          you stay in the loop.  When you exit through a different
  1152.          location, you have probably bypassed the code and now, you
  1153.          can enter "G" to see what happens.
  1154.  
  1155.          Situation 2 - Exit from a copy protected CALL
  1156.          ---------------------------------------------
  1157.               When a copy protection coding reveals itself on the
  1158.          screen, you can have a situation in which you are not
  1159.          returned to the debugger, instead, causing you to exit the
  1160.          program.  In this case, you have to restart the program and
  1161.          trace into the CALL using "T".  After that, you can start
  1162.          using "P" again to uncover the location of the code.  You
  1163.          will most likely encounter a condition that will resemble
  1164.          situation 1.  Follow its instructions.
  1165.  
  1166.          Shortcuts For Keyword Entry Protections
  1167.          ---------------------------------------
  1168.               With keyword entry systems, you might be lucky to have
  1169.          the codes stuck somewhere into file in its
  1170.          uncompressed/unencrypted form.  This means that you can "see"
  1171.          the keywords in its ASCII format.  This case is cool because
  1172.          you won't have to do any tracing to crack the program.  All
  1173.          you have to do is to dump the contents of the files to find
  1174.          something that looks like a keyword.  (Always backup the file
  1175.          that you are about to alter.)  When you have found such a
  1176.          file and the location of the codes, all you have to do now is
  1177.          to change the codes to values that you know.  For example,
  1178.          one code might call for you to enter "PIRATE".  It's a bitch
  1179.          if you don't know the code.  But if you change the code to
  1180.          your name or something else you will never forget ("CYBORG"),
  1181.          then you'd be set.
  1182.               However, in most instances, you can't simple just type
  1183.          over the old code with your new code.  In high level
  1184.          languages, these codes are stored as strings.  In 'C',
  1185.          strings are stored in their ASCII equivalent.  They are then
  1186.          terminated with a NULL character (this is a 0).  In Pascal,
  1187.          the lengths of the strings are first stored in the first
  1188.          position.  Then, the ASCII is stored.
  1189.  
  1190.          NULL Terminated Strings
  1191.          -----------------------
  1192.               So, if you see zeros after the codes, this is a NULL
  1193.          terminated string.  Now, start at the beginning of the string
  1194.          and enter your code.  Then, enter the '0'.  Make sure your
  1195.          string is less than the original string since 'C' refers to
  1196.          these strings also with pointers.
  1197.  
  1198.          Pre-Length Indentifier
  1199.          ----------------------
  1200.               If you see numbers before strings, enter your own code.
  1201.          Then change the length of the code appropriately.  Make sure
  1202.          you do not exceed the length of the original string.
  1203.  
  1204.  
  1205.  
  1206.  
  1207.                                     Page 18
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.                                                    The Cracking Manual
  1214.  
  1215.  
  1216.  
  1217.          Code Guards Through Pointed Icons
  1218.          ---------------------------------
  1219.               We have a case where we do not type in keywords.
  1220.          Rather, we must use a pointer device such as the cursor keys
  1221.          on the keyboard, the mouse, or joystick.  These protections
  1222.          are a bit more complicated since there are no strings to
  1223.          compare against.  Rather, the input will be a number stored
  1224.          in memory or a register.  This is what makes this copy
  1225.          protection more difficult to crack.  We have to hunt through
  1226.          code to find out which compare instruction is the key.
  1227.               What you have to do is to find the general location of
  1228.          the copy protection code as before.  Then, instead of typing
  1229.          in the keyword, you select the icon.  Like before, you must
  1230.          step slowly through the code and go until the program JUST
  1231.          STOPS asking you for the code.  For example:
  1232.  
  1233.          2E0B:0000 E8740E         CALL   0E77
  1234.          2E0B:0003 38D0           CMP    AL,DL
  1235.          2E0B:0005 7569           JNZ    0070
  1236.          2E0B:0007 CB             RETF
  1237.  
  1238.          You might decide to trace over the call at address xxxx:0000.
  1239.          But then, you see that the screen displayed the icons and you
  1240.          got to select the code.  Then, the procedure does some disk
  1241.          activity and you return to address xxxx:0003.  If you see
  1242.          something happen after you have just finished entering the
  1243.          code or if it is slow in returning you to debug, then,
  1244.          some code must have been performed before you returned.  In
  1245.          this case, you must trace into the CALL to see what has
  1246.          happened.  If not, there is still a small probability that
  1247.          there were some instructions that formatted the code you
  1248.          entered and saved it to a memory location.  (We'll talk about
  1249.          multiple doc checks later.)
  1250.               Realize that most of the programs that you will be
  1251.          cracking have been programed by C or some other high level
  1252.          language.  These languages often use the stack (SS:SP) to
  1253.          pass parameters (variables) or to create local variables for
  1254.          a procedure's use.  Most likely, you will see compares to
  1255.          data contained within the stack such as "CMP AX,WORD PTR
  1256.          [BP+10]" or "MOV DX,WORD PTR [BP+10]".  This is what you hope
  1257.          to find, although not always the case.  If you do see some
  1258.          access via the stack using the BP register as a pointer, you
  1259.          may have something there.  Then, all you would have to do is
  1260.          to mess around the flags register (most likely, JZ/JE will be
  1261.          used) at the compare instruction.
  1262.  
  1263.          Multiple Doc Checks
  1264.          -------------------
  1265.               There are some wares that invoke multiple doc checks,
  1266.          doc checks that pop up either systematically or randomly.  In
  1267.          addition, there could also be two types of this protection.
  1268.          The doc check could be a similar type (eg. typing the code
  1269.          found on page...) or they could be different (eg. typing in
  1270.          the code on page... then select the correct icon), although
  1271.  
  1272.  
  1273.                                     Page 19
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.                                                    The Cracking Manual
  1280.  
  1281.  
  1282.  
  1283.          the latter is more rarely used due to its extensive memory
  1284.          usage.
  1285.  
  1286.          Situation 1 - Similar doc checks
  1287.          --------------------------------
  1288.               Cracking multiple doc checks that are similar is just
  1289.          like cracking with just one doc check.  The procedure to
  1290.          trace is still the same.  Keep Proceeding until you come up
  1291.          to the CALL that contains the copy protection.  Just use the
  1292.          sequences mentioned above.  When you are absolutely positive
  1293.          that the call contains the copy protection (skip the CALL and
  1294.          see what happens; if the protection has been bypassed but
  1295.          appears at other times, you got something), here is what you
  1296.          do.
  1297.  
  1298.               1)  Note what type of CALL it was.  Near if the operand
  1299.                   (number after the CALL) was a four digit number or
  1300.                   far if the operand contained the segment:offset
  1301.                   pair.
  1302.               2)  Trace INTO the call.
  1303.               3)  At the first instruction, note the address inside
  1304.                   the CALL.
  1305.               4)  Then, type in "A" then the address of that very
  1306.                   first instruction.
  1307.               5)  If there was a near call performed, now type in
  1308.                   "RETN", otherwise, type in "RETF".
  1309.               6)  Now run the program ("G") and see what happens.
  1310.  
  1311.          If this call was definitely the copy protection, you should
  1312.          have bypassed the copy protection completely.  Otherwise, you
  1313.          might have a case like situation 2.
  1314.  
  1315.          Situation 2 - Different doc check types
  1316.          ---------------------------------------
  1317.               Again, cracking multiple doc checks are like cracking
  1318.          single doc checks.  You follow the same procedures until you
  1319.          come up to a copy protected location.  Then, you would trace
  1320.          into the code as explained in situation 1 just to make sure
  1321.          that the code is not called up again.  Different doc checks
  1322.          are a bitch to do because you have to manually keep tracing
  1323.          until you find each one to effectively rid yourself of the
  1324.          copy protection.  There is not sure way of getting rid of all
  1325.          the doc checks any other way.  But luckily, there are very
  1326.          few wares out there like this.  Remember, the more the
  1327.          company shoves into the program's memory, the more money it's
  1328.          gonna cost them.
  1329.  
  1330.               Of course, I cannot cover every single type of doc check
  1331.          since there are too many of them.  You'd just have to use
  1332.          your own imagination to solve some of them.
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.                                     Page 20
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.                                                    The Cracking Manual
  1346.  
  1347.  
  1348.  
  1349.                                SPECIAL SITUATIONS
  1350.  
  1351.          Special Situations
  1352.          ------------------
  1353.               What all crackers are faced with at one time or another
  1354.          are situations that call for intuitive thinking to overcome
  1355.          the barrier.  Remember, there is no one sure way of cracking.
  1356.  
  1357.          INT 3 - Problems During Tracing
  1358.          -------------------------------
  1359.               Sometimes, when you start cracking, you just find your
  1360.          instruction pointer messing up.  You keep tracing and
  1361.          tracing, then your computer freezes.  But then, when you type
  1362.          "G" at the beginning of the program, it works just fine.
  1363.          What is happening here?  There are several things that the
  1364.          program could do to impede tracing.  Unless you have a
  1365.          hardware debugger, you have to settle in for more primitive,
  1366.          intuitive methods.  First, we have to find out how a software
  1367.          debugger works.
  1368.               I now introduce you to INT 3 and INT 1.  They are the
  1369.          breakpoint and single stepping interrupts respectively.  We
  1370.          will be looking at INT 3 the most.
  1371.               What happens when you set breakpoints?  Well, here is
  1372.          what the debugger does.  At the address you have specified,
  1373.          the debugger will read in the byte at that address and store
  1374.          it somewhere else in its own memory.  This byte is part of
  1375.          the whole instruction located at that address.  For example,
  1376.          if there was an "INT 13" at that location, the machine
  1377.          language equivalent will be CD13h.  Debug will read in the
  1378.          first byte, CDh, and save it in memory.  The CDh will then be
  1379.          replaced by INT 3 (CCh).  So, the code will now look like
  1380.          CC13h in machine language.  When you unassemble this at the
  1381.          address, you will see "INT 3" (the instruction only takes up
  1382.          one byte) and some gibberish after that.  So, when the CPU
  1383.          comes up to this address, it will encounter INT 3 and will
  1384.          return control to the debugger.  The debugger then replaces
  1385.          the INT 3 with the CDh byte used before.
  1386.               With single stepping, the same thing occurs.  Debug will
  1387.          also insert the INT 3 instruction at the instruction after
  1388.          the one you are about to execute.  Then, internally, a "G"
  1389.          instruction is performed until it reaches the INT 3, at which
  1390.          point, the byte will be replaced and everything will be cool.
  1391.  
  1392.          Use of INT 3 to Call Up Other Interrupts
  1393.          ----------------------------------------
  1394.               This INT 3 deal seems to be cool, working in many
  1395.          situations.  But what if the software vendor reprograms INT 3
  1396.          to point to an INT 21?  Many programs use INT 21 to access
  1397.          DOS functions like reading a file, etc.  There would be a
  1398.          conflict now as the program uses INT 3 to call up DOS while
  1399.          debug wants to use INT 3 for its breakpoints.  There is also
  1400.          another problem.  INT 21 uses two bytes (CD21h) while INT 3
  1401.          uses only one byte (CCh).  Therefore, you cannot replace INT
  1402.          3 with the INT 21.
  1403.  
  1404.  
  1405.                                     Page 21
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.                                                    The Cracking Manual
  1412.  
  1413.  
  1414.  
  1415.               Also, INT 3 could be reprogrammed so that everytime it
  1416.          is used, the program will just exit to its higher process.
  1417.          So everytime you single step, you will be kicked out of the
  1418.          program.
  1419.  
  1420.          Parity Errors with INT 3
  1421.          ------------------------
  1422.               The tough copy protections use the change of memory to
  1423.          obstruct tracing.  Examine the code below:
  1424.  
  1425.          2E0B:0500 FC             CLD
  1426.          2E0B:0501 B80000         MOV    AX,0000
  1427.          2E0B:0504 BB0000         MOV    BX,0000
  1428.          2E0B:0507 BE0005         MOV    SI,0500
  1429.          2E0B:050A BF0010         MOV    DI,1000
  1430.          2E0B:050D B90005         MOV    CX,0500
  1431.          2E0B:0510 AC             LODSB
  1432.          2E0B:0511 345A           XOR    AL,5A                         ;'Z'
  1433.          2E0B:0513 01C3           ADD    BX,AX
  1434.          2E0B:0515 AA             STOSB
  1435.          2E0B:0516 E2F8           LOOP   0510
  1436.          2E0B:0518 3B1E0043       CMP    BX,[4300]
  1437.          2E0B:051C 7403           JZ     0521
  1438.          2E0B:051E E9EF2A         JMP    3010
  1439.          2E0B:0521 D1E0           SHL    AX,1
  1440.  
  1441.          Notice what the program is doing.  It is performing a simple
  1442.          decryption of a block of code from address 500h and putting
  1443.          it in address 1000h.  In addition, there is a checksum being
  1444.          performed at address .  The program is adding all those bytes
  1445.          up, then comparing the number with some other number (a
  1446.          checksum value) in memory at address 4300h.  So what you may
  1447.          say.  When the program is run without any set breakpoints,
  1448.          the program will run fine.  But when you start tracing
  1449.          through the code, or putting a breakpoint somewhere after the
  1450.          loop, the program will cause you to exit.  If you decide to
  1451.          change the program so that it will let you pass regardless of
  1452.          the checksum value, somewhere along the line, the program
  1453.          will fuck up.
  1454.               This goes back to the idea of INT 3.  Right before debug
  1455.          executes an instruction, it places an INT 3 at the next
  1456.          instruction.  In this program, when debug places this
  1457.          interrupt and executes an instruction, the program is reading
  1458.          in this INT 3 at the address and copies it to a different
  1459.          address.  INT 3 is obviously a different number than the
  1460.          other instructions, so the checksum value will be different.
  1461.          So, now that INT 3 is copied to another location in memory,
  1462.          debug also cannot replace that with it's original byte value.
  1463.          Therefore, if you try to force the checksum to match and
  1464.          continue running the program, the program will crash because
  1465.          the INT 3 is causing the instructions after itself to be
  1466.          interpreted incorrectly by the CPU.
  1467.               To bypass this, you have to make sure not to get your
  1468.          INT 3 placed in the wrong place at the wrong time.  Looking
  1469.  
  1470.  
  1471.                                     Page 22
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.                                                    The Cracking Manual
  1478.  
  1479.  
  1480.  
  1481.          at the program, you can keep tracing normally until the SI
  1482.          register points to any byte past the CMP instruction at
  1483.          address 519h.  Then, you can do a "G 518" to finish off the
  1484.          loop quicker.  Debug will place a temporary INT 3 at address
  1485.          518h, but it doesn't matter now since SI will be past 518h.
  1486.          This is obviously a simple example, but it gets the point
  1487.          across that you have to watch where you trace.
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.                                     Page 23
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.                                                    The Cracking Manual
  1544.  
  1545.  
  1546.  
  1547.                                 OVERLAYS/LOADERS
  1548.  
  1549.          Overlays/Loaders
  1550.          ----------------
  1551.               Sometimes, programs will have an initialization code and
  1552.          upon its completion, call up another program or overlay.
  1553.          These programs present unique situations in which it is
  1554.          sometimes difficult, after finding the copy protection code,
  1555.          to write the changes to disk.  Let's see what these programs
  1556.          do before we go on to the next topic of making changes
  1557.          permanent.
  1558.               Loaders are usually small programs that might first ask
  1559.          you for the graphics mode or what sound card you have.  When
  1560.          finished, it will load up another program.  Sometimes, this
  1561.          is done with DOS' interrupt 21h, function 4B00h (load and
  1562.          execute).  This is the same interrupt DOS uses to load up
  1563.          programs when you type them in at the DOS prompt.  You can
  1564.          tell what file is going to be executed by tracing up to the
  1565.          INT 21 instruction and dumping the address pointed to by
  1566.          DS:DX (type in "D DS:DX").  Also, internal procedures could
  1567.          be used to call up the program.  Use what you've learned to
  1568.          trace through them.
  1569.               Code decryptions or dynamic heap allocation where data
  1570.          is to be loaded presents problems as well.  Code that changes
  1571.          as the program progresses makes code changes difficult in the
  1572.          file itself.  And when you want to alter sometime in the data
  1573.          area, something called a heap is often used to store the
  1574.          data.  The thing with the heap is that it can be allocated at
  1575.          anytime and depending on what is currently in memory, you
  1576.          can't tell where the memory is going to be located.  In these
  1577.          cases, you might choose to go with run-time memory overlays
  1578.          (discussed later).
  1579.  
  1580.          Writing the Changes Out to the File
  1581.          -----------------------------------
  1582.               Okay, so you've found the copy protection.  You also
  1583.          know how to bypass it.  Now, the next problem you will most
  1584.          likely encounter is writing it out to a file.  But first,
  1585.          let's assume a simple case.
  1586.  
  1587.          Using a Hex Dump Program
  1588.          ------------------------
  1589.               Included is this package is one of the files from Norton
  1590.          Utilities which does a decent job of finding and changing the
  1591.          contents of files.  Before we exit that debugger, we must
  1592.          know what to look for.
  1593.  
  1594.               1)  At the location of the instruction, copy down the
  1595.                   machine language equivalent of the instruction.  At
  1596.                   instructions after that, also take down their
  1597.                   machine level equivalents.  This is what you will
  1598.                   use to search for the code in the file.
  1599.                   a)  If there is a near call or a near jump or a near
  1600.                       memory access, you can just write down all the
  1601.  
  1602.  
  1603.                                     Page 24
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.                                                    The Cracking Manual
  1610.  
  1611.  
  1612.  
  1613.                       hex numbers.
  1614.                   b)  If there is a far call (CALL DS:[5C10+BX]) or a
  1615.                       far jump (JMP DWORD PTR ES:[5080+BX]) or a far
  1616.                       memory access (MOV AX,WORD PTR ES:[10+SI]), then
  1617.                       do not write these instructions down.  In .EXE
  1618.                       files, anything that is located in different
  1619.                       segments will have different displacement
  1620.                       values.  This is a value in the file.  At the
  1621.                       beginning of the file is a table that tells DOS
  1622.                       where these instructions are located.  When the
  1623.                       program is loaded into memory, the pointers are
  1624.                       changed appropriately to match the memory
  1625.                       location.  So, write down other near
  1626.                       instructions like CLD, JZ 100, INC AX, etc.
  1627.               2)  After you know what to search for, you must now know
  1628.                   what you will have to be changing.  Very often,
  1629.                   NOP's are used to "delete" code.  For example, if
  1630.                   there is a CALL 3140 and we want to skip this call,
  1631.                   we can NOP it out.  The near call takes up three
  1632.                   bytes.  The NOP takes up one byte.  So, type in "A"
  1633.                   at the address of the call and enter "NOP" three
  1634.                   times.  Then unassemble the code to make sure that
  1635.                   the code still looks okay.  Take down the machine
  1636.                   level equivalents of the NOP's (90h).  Same thing
  1637.                   with conditional jumps.  Suppose you have a JZ 90
  1638.                   and you want it to jump to address 90 everytime,
  1639.                   then type in "A" at the jump instruction and enter
  1640.                   "JMP 90".  Then, just write down the machine code as
  1641.                   before.  One thing, however.  You cannot do what I
  1642.                   have just said above with far calls.  Remember, the
  1643.                   numbers will be different in the file as compared to
  1644.                   memory.  So what do you do?  No problemo.  At the
  1645.                   call instruction, trace into the call and place a
  1646.                   "RETF" instruction at the address of the callee.
  1647.                   This will be the location that you will search for
  1648.                   (write down the bytes here) and where you will be
  1649.                   writing to (RETF is CBh in machine language).
  1650.               3)  Finally, after all this is through, you can enter
  1651.                   your file editor and search for the numbers you
  1652.                   wrote down.  Then, you can change the numbers.  Now
  1653.                   run the program and it should be cracked.  But
  1654.                   remember, always backup the file you are about to
  1655.                   change.
  1656.  
  1657.          Using a Memory Overlay
  1658.          ----------------------
  1659.               When do you use these things?  You would use memory
  1660.          overlays when step 3 (stated above) has failed in some way.
  1661.          Maybe you couldn't find the code, or when you change it, the
  1662.          program freezes up.  Don't fret, the memory overlay is here.
  1663.          What is a memory overlay?  It is an external program (TSR)
  1664.          that when it reaches a certain point during program
  1665.          execution, it will change the location in memory you have
  1666.          specified.  It overlays the code during run time.
  1667.  
  1668.  
  1669.                                     Page 25
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.                                                    The Cracking Manual
  1676.  
  1677.  
  1678.  
  1679.               Here is what you will need to do to make the overlay
  1680.          work.  First, you must find some way for the program to call
  1681.          up the overlay code.  This can most easily be done by
  1682.          reprogramming interrupts.  So, the first thing you have to do
  1683.          is look for an interrupt usage near the copy protection code
  1684.          (usually an INT 21h or INT 10h).  When you find this
  1685.          interrupt (it must be fairly close to the code), write down
  1686.          the address of the NEXT instruction.  You must get down the
  1687.          segment and the offset.  Also, get down the current status of
  1688.          the registers.  For interrupts like INT 21h and INT 10h,
  1689.          write down the functions numbers (eg. AX,AL,BX,DX,etc.).
  1690.          Then, keep tracing until the copy protection code.  Get the
  1691.          address of the instruction that you want to change (the
  1692.          segment and the offset).  Also get down the machine language
  1693.          equivalent of the changed code.  This should be all you need
  1694.          for the overlay program.  Here is the overlay program:
  1695.  
  1696. INT_SEG         equ     1DA5h           ;SEG:OFF of instruction after the
  1697. INT_OFF         equ     05D1h           ; calling interrupt
  1698. CHANGE_SEG      equ     2DA5h           ;SEG:OFF of instruction to change
  1699. CHANGE_OFF      equ     0432h
  1700.  
  1701. OVERLAY segment para    'code'
  1702.  
  1703.         assume  cs:OVERLAY,ds:OVERLAY
  1704.  
  1705.         org     100h                    ;This will be a .COM program
  1706.  
  1707. START:  jmp     INITCODE                ;Initialization code
  1708.  
  1709. ;**************************************************************************
  1710.  
  1711. OLDINT          dw      0,0             ;Storage for old interrupt address
  1712.  
  1713. ADDR_OFF        equ     <word ptr [bp+2]>
  1714. ADDR_SEG        equ     <word ptr [bp+4]>
  1715.  
  1716. CR              equ     0Dh             ;Carriage return
  1717. LF              equ     0Ah             ;Line feed
  1718. BEEP            equ     07h             ;Beep
  1719. EOS             equ     '$'             ;End of DOS string
  1720.  
  1721. DISPLACEMENT    equ     CHANGE_SEG - INTSEG
  1722.  
  1723. ;**************************************************************************
  1724.  
  1725. NEWINT  proc    far
  1726.  
  1727.         push    bp                      ;Establish stack frame
  1728.         mov     bp,sp
  1729.         push    ax                      ;Save necessary registers
  1730.         push    bx
  1731.         push    cx
  1732.         push    dx
  1733.  
  1734.  
  1735.                                     Page 26
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.                                                    The Cracking Manual
  1742.  
  1743.  
  1744.  
  1745.         push    si
  1746.         push    di
  1747.         push    ds
  1748.         push    es
  1749.  
  1750.         mov     bx,ADDR_OFF             ;Get offset
  1751.         cmp     bx,INT_OFF
  1752.         jnz     EXIT
  1753.  
  1754.         cmp     ax,0201h                ;Check for AX=0201h     <=(1)
  1755.         jnz     EXIT
  1756.         cmp     bx,0001h                ;Check for BX=0001h     <=(2)
  1757.         jnz     EXIT
  1758.  
  1759.         mov     bx,ADDR_SEG             ;Get segment
  1760.         add     bx,DISPLACEMENT
  1761.         mov     ds,bx                   ;This will be the segment of change
  1762.  
  1763.         ;change the number at the next line to point to the offset of
  1764.         ; the address to be changed
  1765.         mov     bx,1C12h                ;This is the offset of the change
  1766.         mov     al,0EBh                 ;This is the byte to be changed
  1767.         mov     [bx],al
  1768.  
  1769.         ;change the number at the next line to point to the offset of
  1770.         ; the address to be changed
  1771.         mov     bx,1C20h                ;This is the new offset of the change
  1772.         mov     ax,0B8h                 ;This is the byte to be changed
  1773.         mov     [bx],ax
  1774.         mov     al,0                    ;This is the next byte to be changed
  1775.         mov     [bx+2],al
  1776.  
  1777.         pop     es                      ;Restore necessary registers
  1778.         pop     ds
  1779.         pop     di
  1780.         pop     si
  1781.         pop     dx
  1782.         pop     cx
  1783.         pop     bx
  1784.         pop     ax
  1785.         pop     bp
  1786.         iret                            ;Interrupt return
  1787.  
  1788. EXIT:   pop     es                      ;Restore necessary registers
  1789.         pop     ds
  1790.         pop     di
  1791.         pop     si
  1792.         pop     dx
  1793.         pop     cx
  1794.         pop     bx
  1795.         pop     ax
  1796.         pop     bp
  1797.         jmp     dword ptr cs:OLDINT     ;Jump to old interrupt
  1798.  
  1799.  
  1800.  
  1801.                                     Page 27
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.                                                    The Cracking Manual
  1808.  
  1809.  
  1810.  
  1811. NEWINT  endp
  1812.  
  1813. ;**************************************************************************
  1814.  
  1815. FINISH  equ     $
  1816.  
  1817. MESSAGE db      "This is an overlay loader.",CR,LF
  1818.         db      "Written by The Cyborg.",CR,LF,BEEP,EOS
  1819.  
  1820. INITCODE:
  1821.         mov     ax,cs
  1822.         mov     ds,ax                   ;DS point to CS
  1823.  
  1824.         mov     ah,9                    ;Print string
  1825.         mov     dx,offset MESSAGE       ;The address of the message
  1826.         int     21h
  1827.  
  1828.         mov     ax,3510h                ;Get old interrupt address
  1829.         int     21h
  1830.         mov     OLDINT[0],bx            ;Save in memory for later use
  1831.         mov     OLDINT[2],es
  1832.  
  1833.         mov     ax,2510h                ;Set new interrupt address
  1834.         mov     dx,offset NEWINT        ;Point to new procedure
  1835.         int     21h
  1836.  
  1837.         lea     dx,FINISH               ;CS:DX of last byte of code to remain
  1838.         int     27h                     ; in memory.  Terminate and stay
  1839.                                         ; resident.
  1840.  
  1841. OVERLAY ends
  1842.  
  1843.         end     START
  1844.  
  1845.          All you have to do is set the first four values in the first
  1846.     four lines of the file.  They are the segment:offset pairs of the
  1847.     interrupt address and the address of the bytes to be changed.
  1848.     Also, change the functions to check for at (1) and (2) to
  1849.     appropriately check for proper code entry.  Then, specify which
  1850.     bytes you will be changing at the specified lines.  Then compile
  1851.     this crack ("ASM OVL {enter}").
  1852.          The next program demonstrates a simple loader.  It also
  1853.     demonstrates what you can do if you have a program that utilizes
  1854.     scripts or dynamically allocated data areas in heap spaces.  This
  1855.     program scans for a known segment in memory for a "keyword".  When
  1856.     it finds this, it can then begin writing new code to overlay the
  1857.     old data.  Note, KEYWORD specifies the keyword to look for.  Then,
  1858.     CRK (0's) is the list of bytes to replace the data areas pointed
  1859.     to by addresses listed in LIST.  The addresses in LIST are
  1860.     displacement addresses.  This means that at the address the
  1861.     keyword was found in, the appropriate number listed in LIST is
  1862.     added to that address.  There are thirteen addresses whose data
  1863.     are to be changed in this case.
  1864.          Also interesting to note is that this program is using two
  1865.  
  1866.  
  1867.                                     Page 28
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.                                                    The Cracking Manual
  1874.  
  1875.  
  1876.  
  1877.     interrupt vectors, INT F1h and INT 21h.  INT 21h is used in the
  1878.     same way as the above overlay program uses it.  It replaces two
  1879.     bytes at offset 1FE5h with CDF1h.  This is the machine language
  1880.     equivalent of INT F1h.  Now, let's examine what INT F1h actually
  1881.     does.  First, it changes the return address in the stack so that
  1882.     instead of returning to the address right after the INT F1h
  1883.     instruction, it will return to another instruction, located at
  1884.     offset 1FE5.  This is the location of the INT F1h instruction.
  1885.     This interrupt, upon its completion, will replace the INT F1h
  1886.     instruction with the original instruction and run the program
  1887.     normally.
  1888.          The loader itself is simple.  It reallocates the memory
  1889.     located to itself to accommodate a "daughter" program, the program
  1890.     that it is going to load.  If it can't find the program or if an
  1891.     error has occurred trying to execute the program, the loader will
  1892.     load itself up as a TSR.  Then, you can run the program via DOS.
  1893.     This loader also checks if INT F1h has been occupied and returns
  1894.     an error if it is.
  1895.  
  1896. LOADER  segment para    'code'
  1897.  
  1898.         assume  cs:LOADER,ss:LOADER
  1899.  
  1900.         org     100h
  1901.  
  1902. BEGIN:  jmp     INIT
  1903.  
  1904. CR      equ     0Dh
  1905. LF      equ     0Ah
  1906. BEEP    equ     07h
  1907. EOLN    equ     '$'
  1908.  
  1909. OPTION  db      1                       ;Options
  1910. CRC     dw      0                       ;Cyclic Redundency Checking data
  1911.  
  1912. START   equ     $
  1913.  
  1914. OLDINT1 dw      0,0
  1915. OLDINT2 dw      0,0
  1916. KEYWORD db      "weat"
  1917. CRK     db      0,0,0,0
  1918. LIST    dw      0h,014h,019h,02Dh,041h,046h,05Ah,05Fh,073h,087h,08Ch,0A0h,0B4h
  1919.  
  1920.         ;********** New Interrupt 1 **********;
  1921.  
  1922. NEWINT1 proc    far
  1923.  
  1924.         push    bp                      ;Establish stack frame
  1925.         mov     bp,sp
  1926.         push    ax                      ;Save registers
  1927.         push    bx
  1928.         push    cx
  1929.         push    dx
  1930.         push    di
  1931.  
  1932.  
  1933.                                     Page 29
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.                                                    The Cracking Manual
  1940.  
  1941.  
  1942.  
  1943.         push    si
  1944.         push    ds
  1945.  
  1946.         mov     ax,cs
  1947.         mov     ds,ax
  1948.  
  1949.         mov     ax,word ptr [bp+2]      ;Get offset
  1950.         cmp     ax,1FE7h
  1951.         jnz     EXIT1
  1952.  
  1953. NEXT1:  mov     ax,1FE5h                ;Where to return next
  1954.         mov     word ptr [bp+2],ax
  1955.  
  1956.         mov     ax,word ptr [bp+4]      ;Get segment
  1957.         mov     ds,ax                   ;Put in data segment
  1958.         mov     bx,1FE5h                ;Offset to change
  1959.         mov     ax,0D803h               ;The new code to put in
  1960.         mov     [bx],ax                 ;Store changes
  1961.  
  1962.         mov     ax,cs                   ;Get current data segment
  1963.         mov     ds,ax
  1964.  
  1965.         mov     di,0                    ;Where to start search
  1966.         mov     dx,0FF00h               ;Search the entire segment
  1967.         mov     bx,0
  1968. COMP:   mov     di,bx                   ;Where to begin
  1969.         mov     si,offset KEYWORD       ;Get keyword
  1970.         mov     cx,4                    ;Lenght of keyword
  1971.         repe    cmpsb                   ;Compare until done
  1972.         jz      MATCH
  1973.         inc     bx
  1974.         dec     dx                      ;Done?
  1975.         jz      EXIT1                   ;If no match, exit
  1976.         jmp     COMP
  1977.  
  1978. MATCH:  mov     dx,bx
  1979.         mov     ax,0E07h
  1980.         int     10h
  1981.         mov     bx,offset LIST          ;Get list of codes to change
  1982.         mov     cx,13                   ;Number of locations to change
  1983. NEXT2:  push    cx
  1984.         mov     cx,4                    ;Lenght of string
  1985.         mov     di,[bx]                 ;Get destination
  1986.         add     di,dx
  1987.         mov     si,offset CRK           ;Get string to copy from
  1988.         rep     movsb                   ;Copy String
  1989.         inc     bx                      ;Next location
  1990.         inc     bx
  1991.         pop     cx
  1992.         loop    NEXT2
  1993.  
  1994. EXIT1:  pop     ds                      ;Restore registers
  1995.         pop     si
  1996.         pop     di
  1997.  
  1998.  
  1999.                                     Page 30
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.                                                    The Cracking Manual
  2006.  
  2007.  
  2008.  
  2009.         pop     dx
  2010.         pop     cx
  2011.         pop     bx
  2012.         pop     ax
  2013.         pop     bp
  2014.         iret                            ;Interrupt return
  2015.  
  2016. NEWINT1 endp
  2017.  
  2018.         ;********** New Interrupt 2 **********;
  2019.  
  2020. NEWINT2 proc    far
  2021.  
  2022.         push    bp                      ;Establish stack frame
  2023.         mov     bp,sp
  2024.         push    ax                      ;Save registers
  2025.         push    bx
  2026.         push    ds
  2027.  
  2028.         mov     bx,word ptr [bp+2]      ;Get offset
  2029.         cmp     bx,0Ch                  ;See if called from the proper offset
  2030.         jnz     EXIT2                   ;If not, exit
  2031.  
  2032.         cmp     ah,30h                  ;See if want this function call
  2033.         jnz     EXIT2                   ;If not, exit
  2034.  
  2035.         mov     bx,word ptr [bp+4]      ;Get segment
  2036.         add     bx,0F8Dh                ;New segment
  2037.         mov     ds,bx
  2038.         mov     bx,1FE5h                ;New offset
  2039.         mov     ax,0F1CDh               ;The new instruction
  2040.         mov     [bx],ax                 ;Save changes in memory
  2041.  
  2042. EXIT2:  pop     ds                      ;Restore registers
  2043.         pop     bx
  2044.         pop     ax
  2045.         mov     sp,bp
  2046.         pop     bp
  2047.         jmp     dword ptr cs:OLDINT2    ;Call old interrupt
  2048.  
  2049. NEWINT2 endp
  2050.  
  2051. FINISH  equ     $
  2052.  
  2053.         ;********** Initialization Code **********;
  2054.  
  2055. PARAM   dw      0
  2056.         db      80h,0
  2057. PARAM1  dw      5 dup(0)
  2058. PROG    db      8 dup('1234567890')
  2059.  
  2060. MESS    db      'Savage Empire ßeta Crack v1.0  July 15,1991',CR,LF
  2061.         db      'Loader needed only after creating a character.',CR,LF
  2062.         db      "Press {ENTER} at the copy protection.",CR,LF,BEEP,EOLN
  2063.  
  2064.  
  2065.                                     Page 31
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.                                                    The Cracking Manual
  2072.  
  2073.  
  2074.  
  2075. ERR1    db      'ERROR: Not enough memory.  '
  2076.         db      'Activating TSR sequence.',CR,LF,BEEP,EOLN
  2077. ERR2    db      'ERROR: Could not load program.  '
  2078.         db      'Activating TSR sequence.',CR,LF,BEEP,EOLN
  2079. ERR3    db      'ERROR: Interrupt vector (0xF1) already occupied.',CR,LF
  2080.         db      ' Release memory before restarting.',CR,LF,LF,BEEP,EOLN
  2081.  
  2082. INIT:   mov     ah,9                    ;Print string
  2083.         mov     dx,offset MESS
  2084.         int     21h
  2085.  
  2086.         mov     ax,35F1h                ;Get interrupt vector
  2087.         int     21h
  2088.         mov     OLDINT1[0],bx           ;Save in memory
  2089.         mov     OLDINT1[2],es
  2090.  
  2091.         cmp     word ptr es:[bx],8B55h  ;Check for vector occupation
  2092.         jnz     CONT1
  2093.  
  2094.         mov     ah,9                    ;Write string
  2095.         mov     dx,offset ERR3
  2096.         int     21h
  2097.         mov     ax,4C03h                ;Exit with error 3
  2098.         int     21h
  2099.  
  2100. CONT1:  mov     ax,25F1h                ;Set interrupt vector
  2101.         mov     dx,offset NEWINT1
  2102.         int     21h
  2103.  
  2104.         mov     ax,3521h                ;Get interrupt vector
  2105.         int     21h
  2106.         mov     OLDINT2[0],bx           ;Save in memory
  2107.         mov     OLDINT2[2],es
  2108.  
  2109.         mov     ax,2521h                ;Change interrupt vector
  2110.         mov     dx,offset NEWINT2
  2111.         int     21h
  2112.  
  2113.         cmp     OPTION,0                ;See if wants to run program
  2114.         jz      EXIT3
  2115.  
  2116.         mov     ax,cs
  2117.         mov     ds,ax
  2118.         mov     es,ax
  2119.         mov     bx,offset ENDCODE       ;Get end of memory
  2120.         shr     bx,1                    ;Convert to paragraphs
  2121.         shr     bx,1
  2122.         shr     bx,1
  2123.         shr     bx,1
  2124.         inc     bx
  2125.         mov     ah,4Ah                  ;Reallocate memory
  2126.         int     21h
  2127.         jnc     OKAY1                   ;If no error, continue
  2128.  
  2129.  
  2130.  
  2131.                                     Page 32
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.                                                    The Cracking Manual
  2138.  
  2139.  
  2140.  
  2141.         mov     ah,9h                   ;Write string
  2142.         mov     dx,offset ERR1
  2143.         int     21h
  2144.         jmp     EXIT3
  2145.  
  2146. OKAY1:  mov     ax,cs
  2147.         mov     PARAM,ax
  2148.         mov     PARAM1,ax
  2149.         mov     bx,offset PARAM
  2150.         mov     dx,offset PROG
  2151.         mov     ax,4B00h                ;Load and execute child
  2152.         int     21h
  2153.         jnc     OKAY2                   ;If no error, continue
  2154.  
  2155.         mov     ah,9h                   ;Write string
  2156.         mov     dx,offset ERR2
  2157.         int     21h
  2158.         jmp     EXIT3
  2159.  
  2160. OKAY2:  mov     ax,25F1h                ;Restore interrupt vector
  2161.         lds     dx,dword ptr OLDINT1
  2162.         int     21h
  2163.  
  2164.         mov     ax,2521h                ;Restore interrupt vector
  2165.         lds     dx,dword ptr OLDINT2
  2166.         int     21h
  2167.  
  2168.         mov     ax,4C00h                ;Exit with error code 0
  2169.         int     21h
  2170.  
  2171. EXIT3:  lea     dx,FINISH               ;Offset of booster
  2172.         int     27h                     ;Exit with ejection of booster
  2173.  
  2174. LOADER  ends
  2175.  
  2176.         end     BEGIN
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.                                     Page 33
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.                                                    The Cracking Manual
  2204.  
  2205.  
  2206.  
  2207.                                 CONCLUSION
  2208.  
  2209.     Conclusion
  2210.     ----------
  2211.          Okay, so we've seen the processes of cracking.  If you are
  2212.     just a beginner and don't know much about programming, you
  2213.     probably got lost somewhere right after the introduction.  I would
  2214.     suggest that you spend some time learning assembly before doing
  2215.     anything else.  Actually, you don't have to start out with
  2216.     assembly.  I started programming using BASIC.  When I got really
  2217.     good at it, I jumped into Assembly, regardless of how difficult
  2218.     people said it was.  Assembly is not at all difficult if you have
  2219.     had some previous knowledge of another language.  It is only
  2220.     difficult if you make it hard.  And after you've learned assembly,
  2221.     you get a "feel" for the other languages and can learn them in a
  2222.     matter of days.  Pascal, Modula-2, C, C++, ..., they're are based
  2223.     on assembly language programming.
  2224.          Cracking is like the debugging process of programming.  To
  2225.     become experienced with debugging is to become adept at cracking.
  2226.     You just need lots o' practice as practice makes perfect.
  2227.          One final note.  I got this manual out kinda quickly so there
  2228.     are bound to be errors, inconsistencies in what I've said, unclear
  2229.     passages, etc.  Well, too bad.  If you really want a good manual,
  2230.     tell me or something and I'll consider it.  I got really bored
  2231.     towards the last parts of the manual so it went pretty fast,
  2232.     skipping over some stuff.  If a lot (and I mean A LOT) of people
  2233.     want a better manual, tell me and give me suggestions.  I'll find
  2234.     the time to do it somehow.
  2235.          Anyways, have fun!
  2236.                                        - The Cyborg
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.                                     Page 34
  2264.  
  2265.  
  2266.  
  2267.